﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for DiaDiemDAO
/// </summary>
/// 
namespace DAO
{
    public class DiaDiemDAO:dataProvider
    {
       
        public string getTenDiaDiem(int MaTenDiaDiem)
        {
            string strSQL = "Select TenDiaDiem From TENDIADIEM Where MaTenDiaDiem = " + MaTenDiaDiem;
            return new dataProvider().getStrByString(strSQL, "TenDiaDiem");
        }


        // Lên - Lấy Mã Địa Điểm theo Tên Địa Điểm nhập vào
        public string getMaDiaDiemByTenDiaDiem(string tenDiaDiem)
        {
            string strSQL = "Select MaTenDiaDiem From TUKHOADIADIEM Where TuKhoaTenDiaDiem like '"+tenDiaDiem+"'";
            return new dataProvider().getStrByString(strSQL, "MaTenDiaDiem");
        }
        public bool insert(string TenDiaDiem)
        {
            long MaTenDiaDiem = long.Parse(this.nextID(this.getLastID(), ""));
            string strSQL = "Insert Into TENDIADIEM(MaTenDiaDiem,TenDiaDiem) values(" + MaTenDiaDiem + ",'" + TenDiaDiem + "')";
            return this.executeNonQuery(strSQL);
        }
        public string getLastID()
        {
            return this.getLastID("TENDIADIEM", "MaTenDiaDiem");
        }
    }
}